$(function(){
 $(".zhuan_jirou_btn").click(function () {
  let num = $("#jirou_zhuan_num").val()
  let name = $("#jirou_zhuan_name").val()
  let pass = $("#jirou_zhuan_pass").val()
  let language_type = localStorage.getItem("language_type");
  let data = {
   language_type: language_type,
   token: localStorage.getItem("token"),
   uid: localStorage.getItem("u_id"),
   m_account: name,
   m_num: num,
   m_pass: pass
  }
  if (num == "") {
   layer.open({
    content: language_type == 1 ? '请输入转赠数量' : 'Please enter the quantity of transfer',
    time: 1
   })
  } else if (num < 50) {
   layer.open({
    content: language_type == 1 ? '转赠至少50以上' : 'Minimun transfer 50 and above',
    time: 1
   })
  } else if (name == "") {
   layer.open({
    content: language_type == 1 ? '请输入账号名称' : 'Please enter user ID',
    time: 1
   })
  } else if (pass == "") {
   layer.open({
    content: language_type == 1 ? '请输入交易密码' : 'Please enter secondary password',
    time: 1
   })
  } else {
   $.ajax({
    type: 'post',
    url: baseURL + '/index.php?m=index&c=wei_zhuan',
    data: data,
    success: function success(data) {
     data = JSON.parse(data);
     is_login(data);
     if(data.code==1){
      layer.open({
       content: data.msg,
       time: 1
      })
      setTimeout(function () {
       window.history.go(-1) // 返回上一页
      }, 1500)
     } else if (data.msg == language_type == 1 ? '鸡肉数量不足' : 'Insufficient quantity of meat') {
      layer.open({
       content: data.msg,
       time: 1
      })
      setTimeout(function(){
    	window.location.reload();
      }, 1000);
     } else {
      layer.open({
       content: data.msg,
       time: 1
      })
     }
    }
   })
  }
 })
 language();
 documentName()
})